using UnityEngine;
using System.Collections;

public class EnemyManager : MonoBehaviour 
{
	public Transform enemyInstance;
	public int cooldown = 120;
	int counter = 0;
	float positionX;
	float positionY = 8;
	// Use this for initialization
	void Start () 
	{
	
	}
	
	// Update is called once per frame
	void Update () 
	{
		//every 2 seconds creates a enemy on the screen on a mrandom position
		counter++;
		if (counter % cooldown == 0)
		{
			positionX = Random.Range(-7.0f, 7.0f);
			CreateEnemy();
			counter = 0;
		}
	}
	//creates an instance of the enemy on the screen
	void CreateEnemy()
	{
		Transform clone;
		
		clone = Instantiate(enemyInstance,new Vector3(positionX, positionY, 0),Quaternion.identity)as Transform;
		
	}
}
